#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<int, int> pii;

void solve() {
    int n;
    cin >> n;
    int len = ((n - 1) * n) / 2;
    vector<int> b(len);
    for(int i = 0; i < len; i++) cin >> b[i];
    sort(b.begin(), b.end());
    for(int i = 0; i < len; i += --n) cout << b[i] << ' ';

    cout << '\n';
}

int main() {
    int t;
    cin >> t;
    while(t--) solve();
    return 0;
}